package com.popcorn.board.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.popcorn.action.Action;
import com.popcorn.action.ActionForward;
import com.popcorn.board.dao.BoardDAO;
import com.popcorn.board.model.BoardModel;

public class BoardDetailAction implements Action {

	@Override
	public ActionForward execute(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		BoardDAO BoardDAO = new BoardDAO();

		int idx = Integer.parseInt(request.getParameter("idx"));
		
		BoardModel BoardModel = BoardDAO.modelDetail(idx);
		request.setAttribute("model", BoardModel);
		
		ActionForward forward= new ActionForward();
	   	forward.setRedirect(false);
   		forward.setPath("BoardDetail.jsp");
   		return forward;
	}

}
